1. Field of the Invention
The present invention relates to a memory system having a nonvolatile semiconductor memory, a controller, and a method of controlling the memory system.
2. Description of the Related Art
As an external storage device used in a computer system, an SSD (Solid State Drive) mounted with a nonvolatile semiconductor memory such as a NAND-type flash memory attracts attention. The flash memory has advantages such as high speed and light weight compared with a magnetic disk device.
The SSD includes a plurality of flash memory chips, a controller that performs read/write control for the respective flash memory chips in response to a request from a host apparatus, a buffer memory for performing data transfer between the respective flash memory chips and the host apparatus, a power supply circuit, and a connection interface to the host apparatus (e.g., Japanese Patent No. 3688835).
Examples of the nonvolatile semiconductor memory include nonvolatile semiconductor memories in which a unit of erasing, writing, and readout is fixed such as a nonvolatile semiconductor memory that, in storing data, once erases the data in block units and then performs writing and a nonvolatile semiconductor memory that performs writing and readout in page units in the same manner as the NAND-type flash memory.
On the other hand, a unit for a host apparatus such as a personal computer to write data in and read out the data from a secondary storage device such as a hard disk is called sector. The sector is set independently from a unit of erasing, writing, and readout of a semiconductor memory.
For example, whereas a size of a block (a block size) of the nonvolatile semiconductor memory is 512 kB and a size of a page (a page size) thereof is 4 kB, a size of a sector (a sector size) of the host apparatus is set to 512 B.
In this way, the unit of erasing, writing, and readout of the nonvolatile semiconductor memory may be larger than the unit of writing and readout of the host apparatus.
Meanwhile, data to be recorded in the host apparatus such as a personal computer has temporal locality and spatial locality (e.g., David A. Patterson and John L. Hennessy, “Computer Organization and Design: The Hardware/Software Interface”, Morgan Kaufmann Pub, 2004 Aug. 31). Because of this characteristic, if data is directly recorded according to an address designated by an external apparatus, rewrite processing, that is, erase processing, is concentrated in a specific area in a short time. As a result, the number of times of the erase processing in the specific area disproportionately increases. Therefore, in the NAND flash memory, processing called wear leveling for equally distributing data update sections in a semiconductor memory is performed (see, for example, Japanese Patent Application Laid-open No. 2008-146255).